from sqlalchemy import *
import sqlalchemy
#from sqlalchemy.orm import *

g_DBConnectionStr = 'mssql://sa:sql@XHCOMPUTER/SkyWalkerDB'
myengine = sqlalchemy.create_engine(g_DBConnectionStr)
meta = MetaData(myengine)

meta2 = MetaData()
meta2.bind = myengine

session = create_engine(g_DBConnectionStr, echo=False, auto_identity_insert = False)
#session = create_session(bind=myengine)

statement = select(['LocalUserInfo'], bind=myengine)
print type(statement)
print statement

nodes = Table('nodes', meta,
     Column('id', Integer, primary_key=True),
     Column('parent_id', Integer, ForeignKey('nodes.id')),
     Column('name', String(30)))

class TreeNode(object):
    pass

sqlalchemy.orm.mapper(TreeNode, nodes, properties={
    'children':relation(TreeNode, lazy=False, join_depth=3)
})
